package com.onec.service.channel.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.onec.service.api.enums.ProductEnum;
import com.onec.service.api.enums.StatusEnum;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 代理商:代理业务：
 * 該与customer 中的 merchantbusiness 配合使用：
 *
 * @author ONEC
 */
@Data
@Entity
@Table(name = "t_channel_merchant_business")
public class ChannelMerchantBusiness implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", unique = true)
    private Long id;

    @Column(name = "version", length = 8)
    private Integer version;

    /**
     * 业务编号
     */
    @Column(name = "business_no", length = 16)
    private String businessNo;

    /**
     * 业务编号
     */
    @Column(name = "channel_business_no", length = 16)
    private String channelBusinessNo;

    @Column(name = "product", length = 8)
    @Enumerated(EnumType.STRING)
    private ProductEnum product;
    /**
     * 机构编号
     */
    @Column(name = "merchant_no", length = 16)
    private String merchantNo;
    /**
     * 机构编号
     */
    @Column(name = "channel_merchant_no", length = 16)
    private String channelMerchantNo;
    /**
     * 机构编号
     */
    @Column(name = "channel_no", length = 16)
    private String channelNo;
    /**
     * 机构编号
     */
    @Column(name = "channel_id", length = 8)
    private long channelId;

    /**
     * 创建时间
     */
    @Column(name = "create_time")
    @CreatedDate
    @Temporal(TemporalType.TIMESTAMP)
    @JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm", timezone = "GTM+8")
    private Date createTime;
    /**
     * 变更
     */
    @Column(name = "update_time")
    @LastModifiedDate
    @Temporal(TemporalType.TIMESTAMP)
    @JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm", timezone = "GTM+8")
    private Date updateTime;
    /**
     * 创建者
     */
    @Column(name = "creator", length = 32)
    private String creator;
    /**
     * 产品备注
     */
    @Column(name = "remarks", length = 64)
    private String remarks;
    /**
     * 通道状态
     */
    @Column(name = "status", length = 12)
    @Enumerated(EnumType.STRING)
    private StatusEnum status;

}
